/**
 * Enum for JSON value types
 */
export enum JsonValueType {
  NULL = "null",
  BOOLEAN = "boolean",
  NUMBER = "number",
  STRING = "string",
  ARRAY = "array",
  OBJECT = "object",
}

/**
 * JSON parsing options
 */
export interface JsonToTsOptions {
  /**
   * Root type name, defaults to 'Root'
   */
  rootName?: string;

  /**
   * Whether to format output, defaults to true
   */
  format?: boolean;

  /**
   * Number of spaces for indentation, defaults to 2
   */
  indentSpaces?: number;

  /**
   * Whether to use interfaces instead of type aliases, defaults to false
   */
  useInterface?: boolean;

  /**
   * Whether to add optional marker (?) after property names, defaults to false
   */
  optionalProperties?: boolean;
}

/**
 * Represents a TypeScript type node
 */
export interface TsTypeNode {
  /**
   * Node name
   */
  name: string;

  /**
   * Node type
   */
  type: JsonValueType;

  /**
   * Child nodes (for object and array types)
   */
  children?: TsTypeNode[];

  /**
   * Array element type (only valid when type is ARRAY)
   */
  arrayElementType?: TsTypeNode;

  /**
   * Property mapping (only valid when type is OBJECT)
   */
  properties?: Record<string, TsTypeNode>;

  /**
   * Parent node reference (used for building type hierarchy)
   */
  parent?: TsTypeNode | undefined;
}

/**
 * Represents generated TypeScript type definition
 */
export interface TsTypeDefinition {
  /**
   * Type name
   */
  name: string;

  /**
   * Type definition string
   */
  definition: string;

  /**
   * Child type definitions (nested types)
   */
  children?: TsTypeDefinition[];
}
